package com.atguigu.kafka.produce.demo;

import org.apache.kafka.clients.producer.ProducerInterceptor;
import org.apache.kafka.clients.producer.ProducerRecord;
import org.apache.kafka.clients.producer.RecordMetadata;

import java.util.Map;

/**
 * @ClassName MyInterceptor
 * @DeScription MyInterceptor
 * @Author 剧情再美终是戏
 * @Date 2019/12/4 18:38
 * @Version 1.0
 **/
public class MyTimestampInterceptor implements ProducerInterceptor<Integer, String> {

    public ProducerRecord<Integer, String> onSend(ProducerRecord<Integer, String> record) {
        return new ProducerRecord<Integer, String>(record.topic(), record.partition(), record.key(), System.currentTimeMillis() + record.value());
    }

    public void onAcknowledgement(RecordMetadata metadata, Exception exception) {

    }

    public void close() {

    }

    public void configure(Map<String, ?> configs) {

    }
}
